feat: Add GitHub Action to validate PR contributions#96
Conversation
Adds a workflow that triggers on feat: PRs and runs 4 checks: 1. No modifications to existing kits/bundles/templates 2. Required root files present (config.json, README.md, flows/, etc.) 3. Each flow subdirectory has config.json, inputs.json, meta.json, README.md 4. Warns on changes outside contribution directories Results are posted to the GitHub Actions job summary with a pass/fail table. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughIntroduces a new GitHub Actions workflow that validates pull requests with Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
.github/workflows/validate-pr.yml (2)
63-72: Hardcodedbundles/samplehandling is fragile.The special case for
bundles/sampleat line 68 won't scale if other nested bundle directories are added. Consider a more generic approach that detects nested structures.♻️ Suggested improvement
elif [[ "$file" == bundles/* ]]; then - # bundles/<bundle-name>/... → 2 levels - # Handle nested bundles like bundles/sample/chatbot - local second - second=$(echo "$file" | cut -d/ -f2) - if [ "$second" = "sample" ]; then - echo "$file" | cut -d/ -f1-3 - else - echo "$file" | cut -d/ -f1-2 - fi + # bundles/<bundle-name>/... → 2 levels by default + # For nested bundles, check if second-level dir contains config.json + local base_path + base_path=$(echo "$file" | cut -d/ -f1-2) + local nested_path + nested_path=$(echo "$file" | cut -d/ -f1-3) + # If nested path has config.json, treat as nested bundle + if [ -f "$nested_path/config.json" ]; then + echo "$nested_path" + else + echo "$base_path" + fiAlternatively, document the
bundles/sampleconvention if it's intentional.
44-55: Consider documenting the SKIP_PATHS exceptions.The hardcoded
SKIP_PATHSarray allows bypassing validation for specific projects. While this provides necessary flexibility for existing non-conforming projects, consider adding a comment explaining why each path is skipped, or documenting these exceptions in CONTRIBUTING.md.# Known exceptions to skip + # - templates/indexation: Pre-existing template with legacy structure + # - kits/agentic/stock-analysis: Pre-existing kit with legacy structure SKIP_PATHS=("templates/indexation" "kits/agentic/stock-analysis")
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4eb88517-9c32-4322-b016-563e7ae9995a
📒 Files selected for processing (1)
.github/workflows/validate-pr.yml
| case "$ptype" in | ||
| kit) | ||
| for req in config.json README.md; do | ||
| if [ ! -f "$project_path/$req" ]; then | ||
| ERRORS+=("Missing $req in $project_path") | ||
| CHECK2_PASS=false | ||
| fi | ||
| done | ||
| if [ ! -d "$project_path/flows" ]; then | ||
| ERRORS+=("Missing flows/ directory in $project_path") | ||
| CHECK2_PASS=false | ||
| fi | ||
| ;; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check what files existing kits actually contain to determine the baseline
echo "=== Checking file patterns in existing kits ==="
for kit_dir in kits/*/*/; do
if [ -d "$kit_dir" ]; then
echo "Kit: $kit_dir"
ls -la "$kit_dir" 2>/dev/null | head -15
echo "---"
fi
done | head -100Repository: Lamatic/AgentKit
Length of output: 5140
🏁 Script executed:
#!/bin/bash
# Check for package.json and .env.example across all kits
echo "=== Checking for package.json and .env.example in all kits ==="
echo ""
for kit_path in kits/*/*/; do
if [ -d "$kit_path" ]; then
kit_name=$(basename "$kit_path")
has_package_json="❌"
has_env_example="❌"
has_config="❌"
has_readme="❌"
has_flows="❌"
[ -f "$kit_path/package.json" ] && has_package_json="✓"
[ -f "$kit_path/.env.example" ] && has_env_example="✓"
[ -f "$kit_path/config.json" ] && has_config="✓"
[ -f "$kit_path/README.md" ] && has_readme="✓"
[ -d "$kit_path/flows" ] && has_flows="✓"
echo "Kit: $kit_name"
echo " config.json: $has_config README.md: $has_readme flows/: $has_flows .env.example: $has_env_example package.json: $has_package_json"
fi
doneRepository: Lamatic/AgentKit
Length of output: 1050
Add validation for .env.example and package.json in kit checks.
The workflow validates only config.json, README.md, and flows/ for kits, but documentation requires .env.example and package.json. Evidence shows kits already fail these requirements:
kits/assistant/grammar-extension/is missing both.env.exampleandpackage.jsonkits/embed/content-generation/is missingpackage.json
Both pass the current workflow validation, violating documented requirements.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Summary
.github/workflows/validate-pr.yml— a GitHub Action that automatically validates incomingfeat:PRsfeat:PRs should only add new kits/bundles/templatesTest plan
feat:title adding a valid kit → workflow should pass all checksfeat:title modifying an existing kit → check 1 should failflows/→ check 2 should failmeta.json→ check 3 should failfeat:in the title skip this workflow entirely🤖 Generated with Claude Code
Summary
Adds a new GitHub Actions workflow (
.github/workflows/validate-pr.yml) that validates PR contributions automatically.Workflow behavior:
Validation checks:
config.json,README.md,flows/, etc.)config.json,inputs.json,meta.json,README.md)Output: